package pw.hais.etgsh.adapter;

import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import pw.hais.app.AppAdapter;
import pw.hais.etgsh.R;
import pw.hais.utils.EmptyUtil;

/**
 * Created by Hais1992 on 2015/12/14.
 */
public class YuYinSpinnerAdapter extends AppAdapter<YuYinSpinnerAdapter.SpinnerModel, YuYinSpinnerAdapter.ViewHolder> {


    public YuYinSpinnerAdapter(List<SpinnerModel> mList) {
        super(mList, R.layout.fragment_setting_spinner_item, ViewHolder.class);
    }

    @Override
    public void onBindView(int position, ViewHolder mViewHolder, SpinnerModel mItem) {
        String msg = "[" + mItem.quyu + "]" + mItem.name + "-" + mItem.code;
        mViewHolder.text_title.setText(msg);
    }

    //反射免FindViewById，名称必须和 XML的 控件ID一样
    public static class ViewHolder extends AppAdapter.ViewHolder {
        public TextView text_title;
    }

    public static class SpinnerModel {
        public String quyu;
        public String name;
        public String code;

        public SpinnerModel(String quyu, String name, String code) {
            this.quyu = quyu;
            this.name = name;
            this.code = code;
        }
    }

    public static List<YuYinSpinnerAdapter.SpinnerModel> getSpinnerData(){
        List<YuYinSpinnerAdapter.SpinnerModel> list = new ArrayList<>();
        list.add(new YuYinSpinnerAdapter.SpinnerModel("女生","小燕","xiaoyan"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("男生","小宇","xiaoyu"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("女生","小研","vixy"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("女生","小琪","xiaoqi"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("男生","小峰","vixf"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("儿童","小新","xiaoxin"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("儿童","楠楠","nannan"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("老年","老孙","vils"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("粤语","小梅","xiaomei"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("台湾","小莉","vixl"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("西川","小蓉","xiaorong"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("东北","小芸","xiaoqian"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("河南","小坤","xiaokun"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("湖南","小强","xiaoqiang"));
        list.add(new YuYinSpinnerAdapter.SpinnerModel("陕西","小莹","vixying"));
        return list;
    }
}
